﻿@{
    ViewBag.Title = "AlarmMoStart";
}

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>工单预警</title>
    <link href="~/Scripts/jquery-easyui/themes/bootstrap/easyui.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-easyui/jquery.min.js"></script>
    <script src="~/Scripts/jquery-easyui/jquery.easyui.min.js"></script>
    <script src="~/Scripts/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
    <link href="~/Content/themes/icon.css" rel="stylesheet" />
    <script src="~/Content/js/common.js?v=1"></script>
    <link href="~/Content/themes/table.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-easyui/Extension/jquery-easyui-datagridview/datagrid-detailview.js"></script>
    <script type="text/javascript">

        openTabFormat = function (subtitle, url, icon) {
            var action = '<a href="javascript:void(0)" onclick="window.parent.addTab(\'{0}\',\'{1}\')">查看</a>';
            var htmls = stringFormat(action, subtitle, url);
            return htmls;
        }
        //表格列定义
        var myColums = [[
                       { width: 180, title: '部门', field: 'dept', sortable: true },
                            { width: 100, title: '未开工数量', field: 'c', hidden: false },
                            {
                                width: 100, title: '操作', field: '_operate', formatter:
                            function (val, row, index) {
                                return openTabFormat('开工预警-' + row.dept, '/Project/Projectgrid?view=unStart&Dept=' + row.dept + '&year=2019')// + year)
                            }
                            },
                           
        ]];
        var KeyName = "AlarmMo";
        var eID = "#ui_alarmMo_dg";
        var url = "/Produce/GetAlarmMo";
        $(initDatagrid (KeyName,myColums,eID,url));

        //$(function () {
        //    $.ajax({     //请求当前用户可以操作的按钮
        //        url: "/Button/GetUserAuthorizeButton?r=" + Math.random(),
        //        type: "post",
        //        data: { KeyName: "AlarmMo" },
        //        dataType: "json",
        //        timeout: 5000,
        //        success: function (data) {
        //            if (data.success) {
        //                var toolbar = getToolBar(data);      //common.js
        //                if (data.search) {     //判断是否有浏览权限
        //                    $("#ui_alarmMo_dg").datagrid({
        //                        url: "/Produce/GetAlarmMo",
        //                        striped: true, rownumbers: true, pagination: true, pageSize: 20, singleSelect: true,
        //                        fitColumns: false,
        //                        //idField: 'FBillNo',
        //                        sortName: 'dept',
        //                        sortOrder: 'desc',
        //                        pageList: [20, 40, 60, 80, 100],
        //                        frozenColumns: [],
        //                        columns: myColums,
        //                        toolbar: toolbar.length == 0 ? null : toolbar
        //                    });
        //                }
        //                else {
        //                    $.show_alert("提示", "无权限，请联系管理员！");
        //                }
        //            } else {
        //                $.show_alert("错误", data.result);
        //            }
        //        },
        //        error: function (XMLHttpRequest, textStatus, errorThrown) {
        //            if (textStatus == "timeout") {
        //                $.show_alert("提示", "请求超时，请刷新当前页重试！");
        //            }
        //            else {
        //                $.show_alert("错误", textStatus + "：" + errorThrown);
        //            }
        //        }
        //    })
        //}); 

         
      
    </script>

</head>
<body>
    <div id="ui_user_layout" class="easyui-layout" data-options="fit:true,border:false">
    
        <div data-options="region:'center',border:false">
            <table id="ui_alarmMo_dg" data-options="fit:true,border:false"></table>
        </div>
        <div data-options="region:'south',border:false">
            根据部门汇总首道工序未开工单据数量
        </div>
       
    </div>
</body>
</html>


